cPy.cCore module#
Expand for references to
cPy.cCore
- class BaseClass[source]#
Bases:
objectUse this class for build a class for UI or serialization.see class_reg.h for details about the class registration- GetClassMask() int[source]#
- Masking elements of class. Each member has mask. Element is serializable/visible only if (it’s_mask & hosting_class_mask) != 0
- CopyBaseClass(Dest: BaseClass, Add: bool = False) bool[source]#
- Copy base class to other class uning names correspondence
- Parameters:
Dest (BaseClass) – The destination object
Add (bool) – Add members to class arrays or replace
- Returns:
true if successful
- Return type:
bool
- Save(xml: any, ClassPtr: any, Extra: any = None)[source]#
- Save class to the XML structure
- Parameters:
xml – The result
ClassPtr – The pointer to the data, equals to this if class is directly castable
Extra – Extra data pointer
- Load(xml: any, ClassPtr: any, Extra: any = None) bool[source]#
- Load the class from the XML structure
- Parameters:
xml – The source XML
ClassPtr – The pointer to the data, equals to this if class is directly castable
Extra – Extra data pointer
- Returns:
true if successful
- Return type:
bool
- FullCopy(SrcData: any, SrcDataExtra: any, Dest: BaseClass, DestData: any, DstDataExtra: any, C: any) bool[source]#
- Fast copy from one BaseClass to another. Names and types correspondence used to copy.
- Parameters:
SrcData – Data data pointer
SrcDataExtra – Src extra
Dest (BaseClass) – Destination class
DestData – Destination data
DstDataExtra – Destination extra
C – copy context
- Returns:
true if successful
- Return type:
bool
- SaveBin(Data: any, Extra: any, Out: any, ExDictionary: any, SkipList: any)[source]#
- Save in binaly form. Use only for temporary storage in memory!!!
- Parameters:
Data – data pointer
Extra – extra pointer
Out – Output stream
ExDictionary – Dictionary for enumerators
SkipList – Skip list for enumerators
- LoadBin(Data: any, Extra: any, In: any, ExDictionary: any)[source]#
- Load the class from the memory. Use only for temporary storage in memory!!!
- Parameters:
Data – Pointer to the class data
Extra – Extra data
In – binary stream to read data from
ExDictionary – Additional dictionary
- new_element() BaseClass[source]#
- construct pointer to class of the same type like this. Elements will not be copied into the new place
- GetElement(res: any, idx: int, Ptr: any = None, Extra: any = None) bool[source]#
- The The function returns complete information about the member by it’s index. If you want to walk through all members use _EACH … _EACH_END loop.
- Parameters:
res – All data gathered there
idx (int) – Index of the member
Ptr – Pointer to data (if class is direcly castable it is equal to this, othervice it points to placement of data in memory). If NULL passed, this will be used
Extra – Extra data, used for enumerators and sliders (mostly)
- Returns:
return true if element exists and visible
- Return type:
bool
- GetElementByName(Name: str, Ptr: any, Extra: any, res: any, UI: bool = False, Serialize: bool = True) bool[source]#
- The function returns complete information about the member by it’s name.
- Parameters:
Name (str) – Name of the member
Ptr – Data ptr
Extra – Extra
res – All data gathered there
- Returns:
return true if element exists and visible
- Return type:
bool
- GetElementByNameAndType(Name: str, Type: str, Ptr: any, Extra: any, res: any, UI: bool = False, Serialize: bool = True) bool[source]#
- DeleteDefaultSubFields(xml: any, ClassPtr: any, Extra: any = None)[source]#
- Short form saving. Fields that are unchanged in comparison to default will be skipped in XML.
- ReadFromFile(Name: str, very_safe_with_backup: bool = False) bool[source]#
- Save the object to file or binary stream.Example
| MyClass C; | MyClass C1;
- CanBeDragged(MemberID: str, dx: int, dy: int) bool[source]#
- Use it for build a Drag & Drop element.see CanAcceptDrag(), OnStartDrag(), OnEndDrag(), OnAcceptDrag()
- OnAcceptDrag(DraggedItemParent: BaseClass, DraggedMemberID: str, AcceptorMemberID: str, MyRect: any) bool[source]#
- SetParentsSafe()[source]#
- set parents to this for all child members, each child will be tested for validity
- CurrentSaveFile: str = None#
- If user triggers saving class to file, last filename stored there
- SaveInShortForm: bool = False#
- class cSBool(name: str, value: bool = False, visible: bool = True)[source]#
Bases:
cSItem- Value: bool#
- class cSInt(name: str, value: int = 0, min: int = 0, max: int = 10, visible: bool = True)[source]#
Bases:
cSItem- Min: int#
- Max: int#
- Default: int#
- Value: int#
- class cSFloat(name: str, value: float = 0, min: float = 0, max: float = 10, visible: bool = True)[source]#
Bases:
cSItem- Min: float#
- Max: float#
- Value: float#
- Default: float#
- class cREG[source]#
Bases:
object- static modalMessageBox(text: str, Caption: str, Buttons: str, Flags: int, Class: BaseClass) int[source]#
- static droplist(field: cSInt, enum_id: str)[source]#
- REG_DROPLIST(fieldID, name, EnumID) adds the droplist to UI, list into XML. The referred variable should be inthideinitializer
Example:
::class MyClass : public BaseClass{int x1;int x2;SERIALIZE(){ …//create enumerator just now and use immediatelyREG_DROPLIST(x1, “droplist1”, “Item1|Item2|Item3”);//Other option is to create Enumerator right there or somewhere in code_MAKE_ONCE{//use it to avoid multiple call of codeEnumerator* E = ENUM.Get(“MYENUMERATOR”);if(E->GetAmount() == 0){E->Add(“SomeItem1”,Value1);E->Add(“SomeItem1”,Value2); …}}REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR”);//You may define Enumerator just in one lineMAKE_ENUMERATOR(“MYENUMERATOR2”,”Item1|Item2|Item3”);REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR2”); …}};
- static make_enumerator(enum_id: str, content: str)[source]#
- Make Enumerator in just one linehideinitializer
| MAKE_ENUMERATOR("MYENUMERATOR2","Item1|Item2|Item3");
- ….somewhere…
REG_DROPLIST(x2, “droplist2”, “MYENUMERATOR2”);- Parameters:
content (str) – List of items “Item1,Item2,….”
- static ui_layout(layout: str)[source]#
- UI_LAYOUT(str) splits ui elements to several columns with proportional or fixed widthhideinitializerUI_LAYOUT may use two additional keywords: TOP and BOTTOM. TOP moves controls to the tor of the window frame (header -like)BOTTOM moves elements to the bottom of the frame, like toolset buttons. It is recommended to use ICON_BUTTON/3/4 for bottom toolset.
Example:
| class MyClass : public BaseClass{
void button();void long_button();void X();SERIALIZE(){ …//places next 3 controls in one line: [button][long_button][X], length of [button] is twice less than [long_button], [X] has fixed width 32UI_LAYOUT(“1 2 [32]”);CLASS_METHOD_CALL(button);//[button]CLASS_METHOD_CALL(long_button);//[long_button]CLASS_METHOD_CALL(X);//[X] …}};
- static slider_int(var: cSInt)[source]#
- SLIDER(var,name,minvalue,maxvalue) to add integer/float slider in UI. Only float and int supportedhideinitializer
Example:
::class MyClass : public BaseClass{ *int x;float y; *SERIALIZE(){ …SLIDER(x,”X”,0,10);SLIDER(y,”Y”,0.0,10.0); …}};- Parameters:
var (cSInt) – variable ref
- class LinkedObjectBaseType[source]#
Bases:
object- static registerObjectType(objectType: LinkedObjectBaseType)[source]#
- TopologyLocked: bool#
- objectType: str#
- IconTexture: int#
- extension for file
- class LinkedObject[source]#
Bases:
BaseClass- static dynamic_cast(pObject: BaseClass) LinkedObject[source]#
- An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a LinkedObject class or its descendant, and if so, returns the specified object, but of the LinkedObject type.
- getType() LinkedObjectBaseType[source]#
- idx: int#
- Scaling: float#
- TopologyLocked: bool#
- objectPath: any#
- class cColorSelectorInterface[source]#
Bases:
object- ShowAlpha: bool#
- Red: float#
- Green: float#
- Blue: float#
- Alpha: float#
- class pyRequirement[source]#
Bases:
object- initialized: bool = True#
- module_name: str#
- module_version: str#
- installing_name: str = ''#
- installing_id: int = -1#
- static Check(name: str, install: bool = True, show_progress: bool = False, ask: bool = False, on_finish: any = None) pyRequirement[source]#
- static GetRequirementInfo(name: str) pyRequirement[source]#
- class cExtension[source]#
Bases:
object- extensionHandler: any#
- onMessage(message: str)[source]#
- Call if another module sent message to this extension using cExtension.Message
- onKey()[source]#
- Call it as soon as user pressed the key, get the key value from Widgets::lastKey. Set it to 0 if the key captured and des not need to be propagated anymore.
- class cExtensionHandler[source]#
Bases:
BaseClass- static dynamic_cast(pObject: BaseClass) cExtensionHandler[source]#
- An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a cExtensionHandler class or its descendant, and if so, returns the specified object, but of the cExtensionHandler type.
- mainModule: any#
- onStartUpModule: any#
- Loaded: bool#
- NeedRestartApp: bool#
- extension: cExtension#
- Started: bool#
- Active: bool#
- AutoStart: bool#
- StartAfterInstalls: bool#
- Error: bool#
- dependencies: any#
- class ExtensionManager[source]#
Bases:
BaseClass- static dynamic_cast(pObject: BaseClass) ExtensionManager[source]#
- An analogue of the dynamic_cast function from C++, it checks whether the object pObject is a ExtensionManager class or its descendant, and if so, returns the specified object, but of the ExtensionManager type.
- ProcessID: int = 31560#
- DebugPort: int = 6449#
- static SetExtensionManager(extensionManager: ExtensionManager)[source]#
- MainColorSelector: cColorSelectorInterface = <cModules.QTColorSelector.QTColorSelector.QTColorSelector object>#
- NeedRefreshPyInstalledModuleList: bool = False#
- FindExtension(extName: cStr) cExtensionHandler[source]#